#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""  
@Project : pythonProject
@File : update.py
@Author : 万能小魏
@Time : 2024/8/16 14:32  
@脚本说明 : 

"""
import woniu.dataList as dataList
def updateById():
    selectID = input("请输出您要修改的ID:\n")
    tempList = list(filter(lambda u: u['id'] == selectID, dataList.userList))
    if len(tempList) == 0:
        print("未查询到该ID!")
    else:
        username = input("请输出您的注册账号:\n")
        tempList = list(filter(lambda u: u['username'] == username, dataList.userList))
        if len(tempList) == 0:
            userList = list(map(lambda u: {
                "id": u['id'],
                "username": username,
                "password": input("请输出您的密码:\n"),
                "email": input("请输出您的邮箱:\n"),
                "gender": input("请输出您的性别(男/女):\n"),
                "register": u['register'],
                "age": input("请输出您的年龄:\n"),
                "status": u['status']
            } if u['id'] == selectID else u, dataList.userList))
        else:
            print("该账号已存在!")